﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Ue.Components.VerificationCode
{
    public class VerifyCode
    {
        private VerifyImage descriptor;

        public VerifyCode(VerifyImage descriptor)
        {
            this.descriptor = descriptor;
        }

        public bool Verify(string verifyString)
        {
            return verifyString.Equals(this.descriptor.VerifyString);
        }

        public void BinaryWrite(System.Web.UI.Page page)
        {
            page.Response.ClearContent();
            page.Response.ContentType = this.descriptor.ContentType;
            page.Response.BinaryWrite(this.descriptor.VerifyData);
        }
    }
}
